package main

import (
	"encoding/json"
	"fmt"
)

type User struct {
	UserName string  `json:"username"`
	NickName string  `json:"nickname"`
	Age int  `json:"age"`
	Vip bool  `json:"vip"`
}

func main() {
	u1 := &User{
		UserName: "Sara",
		NickName: "White Canary",
		Age: 29,
		Vip: true,
	}
	if data, err := json.Marshal(u1); err == nil{
		fmt.Println(string(data))
	}
}